import type { BaseTree } from "@/api/types";
import { http } from "@/utils/http";

export type Dept = BaseTree & {
  name?: string;
  leaderId?: string;
  description?: string;
};

/** 获取部门管理列表 */
export const getDeptList = (params?: Dept) => {
  return http.request<Array<Dept>>("get", "/dept", params);
};
export const addDept = (params?: Dept) => {
  return http.request<boolean>("post", "/dept", params);
};
export const updateDept = (params?: Dept) => {
  return http.request<boolean>("put", "/dept", params);
};
export const deleteDept = (id?: string) => {
  return http.request<boolean>("delete", "/dept", { id: id });
};
